<?php
/** 
 * Created by RisingSun. 
 * User: MarkSpace 
 * Date: 20220315
 * Time: 11:05 
 * 用户角色模块
 */
namespace app\admin\model;

use app\admin\model\Model;

class Smscode extends Model{
	
    private $codetable = 'user_code';

    /**
     * 列表
     * @param array $list 
     * @param array $where 
     */ 
    public function list($where=null,$page=1,$page_size=10){
        //数据
        $data['datalist'] = Model::name($this->codetable)
            ->alias('a')
            ->field(' a.* ')
            ->where($where)
            ->limit(($page-1)*$page_size,$page_size)
            ->order('id desc')
            ->select()
            ->toArray();
        //数据总数
        $data['total']=Model::name($this->codetable)
            ->alias('a')
            ->where($where)
            ->count('a.id');
        return $data; 
    } 
    /**
     * index删除
     * @param array $del 
     * @param array $where 
     */ 
    public function del($id){ 
        //删除
        if ($id) {
            Model::name($this->codetable)->where('id='.$id)->delete();
            return true;
        }
        return false;
    }
    
}